<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<div v-size="50">全局自定义指令</div>
			<div v-color="'orange'">局部自定义指令</div>
		</div>
		<div id="app2">
			<div v-size="50">全局自定义指令</div>
		</div>
		<script type="text/javascript">
			//全局自定义指令
			Vue.directive('size', {
				bind(el, binding) {
					el.style.fontSize = binding.value + 'px';
				}
			})
			const vm1 = new Vue({
				el: '#app',
				data: {
					orange: 'green'
				},
				directives: {
					color: {
						bind(el, binding) {
							console.log(el);
							console.log(binding);
							el.style.color = binding.value;
						}
					}
				}
			})
		    const vm2 = new Vue({
		    	el: '#app2',
		    })
		</script>
	</body>
</html>
